﻿/*
    This file is part of nDoctor Light

    NDoctor is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    NDoctor is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with NDoctor.  If not, see <http://www.gnu.org/licenses/>.
*/
namespace Probel.Ldoc.ViewModels.Helpers
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;

    using Probel.Ldoc.Services.Dto;
    using Probel.Ldoc.Services.Services;
    using Probel.Ldoc.ViewModels.Dto;
    using Probel.Ldoc.ViewModels.Pages;
    using Probel.Ldoc.ViewModels.ToolBoxes;

    internal class RecordEditorViewModelBuilder
    {
        #region Fields

        private readonly IErrorService ErrorService;
        private readonly bool IsAsync;
        private readonly RecordEditorViewModel Parent;
        private readonly IPatientService Service;

        #endregion Fields

        #region Constructors

        public RecordEditorViewModelBuilder(RecordEditorViewModel parent, IErrorService errorServoce, IPatientService service, bool isAsync)
        {
            this.Service = service;
            this.Parent = parent;
            this.ErrorService = errorServoce;
            this.IsAsync = isAsync;
        }

        #endregion Constructors

        #region Methods

        public CreateFileViewModel BuildFileViewModel()
        {
            return new CreateFileViewModel(this.Parent, this.ErrorService, this.IsAsync);
        }

        public CreateFolderViewModel BuildFolderViewModel()
        {
            return new CreateFolderViewModel(this.Parent, this.ErrorService, this.Service, this.IsAsync);
        }

        public MacroEditorViewModel BuildMacroEditorViewModel(PatientCardDto currentPatient)
        {
            return new MacroEditorViewModel(this.ErrorService, this.Service, currentPatient, this.IsAsync);
        }

        public RecordHistoryViewModel BuildRecordHistoryViewModel(RecordCardViewModel currentRecord)
        {
            return new RecordHistoryViewModel(this.ErrorService, this.Service, currentRecord);
        }

        public RenameRecordViewModel BuildRenameRecordViewModel(RecordCardViewModel currentRecord)
        {
            return new RenameRecordViewModel(this.ErrorService, this.Service, currentRecord.ToDto());
        }

        #endregion Methods
    }
}